package com.yang.springcloudalibaba.service;

import com.yang.springcloud.pojo.Student;

import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Component
public class AlibabaClientServiceFallback implements StudentClientService {
    @Override
    public Map<String, Object> addStudent(Student s) {
        Map<String, Object> msg = new HashMap<String, Object>();
        msg.put("massage", "Sentinel熔断降级，服务暂时关闭");
        msg.put("code", 500);
        return msg;
    }

    @Override
    public Map<String, Object> delereStudent(String name) {
        Map<String, Object> msg = new HashMap<String, Object>();
        msg.put("massage", "Sentinel熔断降级，服务暂时关闭");
        msg.put("code", 500);
        return msg;
    }

    @Override
    public Map<String, Object> updateStudent(Student s) {
        Map<String, Object> msg = new HashMap<String, Object>();
        msg.put("massage", "Sentinel熔断降级，服务暂时关闭");
        msg.put("code", 500);
        return msg;
    }

    @Override
    public List<Student> queryAll() {
        List<Student> studentList = new ArrayList<>();
        Student s = new Student("120", "Sentinel熔断降级","0000-00-00", "Sorry");
        studentList.add(s);
        return studentList;
    }

    @Override
    public Student queryById(String passid) {
        List<Student> studentList = new ArrayList<>();
        Student s = new Student("120", "Sentinel熔断降级","0000-00-00", "Sorry");
        return s;
    }
}
